package com.yfp.client.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfp.client.domain.SysDictData;
import com.yfp.client.mapper.SysDictDataMapper;
import com.yfp.client.service.SysDictDataService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 *
 * @description 针对表【sys_dict_data(字典数据表)】的数据库操作Service实现
 * @createDate 2024-11-14 10:51:08
 */
@Service
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {

    @Resource
    private SysDictDataMapper sysDictDataMapper;

    @Override
    public List<SysDictData> getDictLabel(String dictType) {
        List<SysDictData> dictLabel = sysDictDataMapper.getDictLabel(dictType);
        return dictLabel;
    }

    @Override
    public String getDefaultReceivingAccount() {
        List<SysDictData> dictLabel = this.getDictLabel("default_receiving_account");
        // 获取默认收款账号
        SysDictData sysDictData = Optional.ofNullable(CollUtil.getFirst(dictLabel)).orElse(new SysDictData());
        String dictValue = Optional.ofNullable(sysDictData.getDictValue()).orElse("1713574062");
        return dictValue;
    }
}




